
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >       
        <link href="../css/Quantricss.css" rel="stylesheet" type="text/css">
        <script type="text/javascript" src="../jquery.js"></script>
        <script type="text/javascript" src="tiny_mce/tiny_mce.js"></script>

        <script>
                $(document).ready(function(){
                $("#ChungLoai").change(function(){
                    $("#LoaiSP").load("Sanpham_thongtinchitietloai.php?idCL=" + $("#ChungLoai").val());
            });
                });
        </script>
    
        <script>
             $(document).ready(function(){
           var a = $('select.list option:selected').attr("value");
                    $("#LoaiSP").load("Sanpham_thongtinchitietloai.php?idCL=" + a, temp());
            });
            function temp()
            {
                var b = $("#updateloaisp").attr("value");
                $("#LoaiSP").attr('value',b);
            }
        </script>
            
<?php
/*echo "<pre>";
print_r($_POST);
echo "</pre>";
exit();*/

    session_start();
    
    require_once ("../mysql.php");
    require_once ("function_quantri.php");
   
   if(isset($_GET['idSP']))
        $idSP = $_GET['idSP'];
         settype($idSP,"int");
   
    $chitietsp = ChiTietSanPham($idSP);
    $rows_chitiet = mysql_fetch_array($chitietsp);
?>
 <form id="form1" name="form1" method="post" action="Sanpham_update_quantri_check.php">
        <table width="100%" border="1" align="center" bgcolor="#FFFF99">
            <tr>
                <td height="38" colspan="2" align="center" bgcolor="#0033FF"><p class="style1"> UPDATE SẢN PHẨM</p></td>
            </tr>
			<tr>
				<td>ID SẢN PHẨM</td>
				<td><input type="text" id="idSP" name="idSP" class="list" value="<?php echo $_GET['idSP']?>"></td>
			</tr>    
            <tr>
                <td width="223" class="ten"><p>TÊN SẢN PHẦM</p><p>&nbsp;</p></td>
                <td width="561"><lable><input name="TenSP" type="text" class="list" id="TenSP" value="<?php echo $rows_chitiet['TenSP']?>"></label></td>
            </tr>    
            <tr>
                <td class="ten"><p>CHỦNG LOẠI</p><p>&nbsp;</p></td>
                <td><label>
                        <select name="ChungLoai" class="list" id="ChungLoai">
                            <option value="0">Chọn chủng loại</option>
                            <?php $chungloai = ChungLoai();
                                $selected="";
                                while($rows_chungloai = mysql_fetch_array($chungloai))
                                {
                                    if($rows_chungloai['idCL']==$rows_chitiet['idCL'])
                                        $selected = "selected ='selected'";
                            ?>
                            <option value="<?php echo $rows_chungloai['idCL'] ?>"<?php echo $selected?>><?php echo $rows_chungloai['TenCL']?></option> 
                            <?php }?>
                         </select>   

                    </label></td> 
            </tr> 
            <tr>
                <td class="ten"><p>LOẠI SẢN PHẨM</p><p>&nbsp;</p></td>
                <td>
                    <select name="LoaiSP" class="list" id="LoaiSP">
                        <option value="0">Chọn loại </option>
                     </select>
                           <input name="updateloaisp" type="hidden" id="updateloaisp" value="<? echo $rows_chitiet['idLoai']?>">

                </td>

             </tr>   
            <tr>
                <td class="ten"><p>MÔ TẢ</p><p>&nbsp;</p></td>
                <td>
                    <label>
                        <textarea class="mrk" name="MoTa" id="MoTa" cols="45" rows="5"><?php echo $rows_chitiet['MoTa']?></textarea>
                       
                    </label>    
                </td>
            </tr>
            <tr>
                <td class="ten"><p>GIÁ</p><p>&nbsp;</p></td>
                <td><input name="Gia" type="text" class="list" id="Gia" value="<?php echo $rows_chitiet['Gia']?>"></td>
            </tr>    
            <tr>
                <td class="ten"><p>UrlHinh</p><p>&nbsp;</p></td>
                <td><input type="text" name="urlHinh"  id="urlHinh" value="<?php echo $rows_chitiet['UrlHinh']?>">
                <input type="file" name="urlHinh" id="urlHinh" value="Chọn File"/>
                </td>
                
             </tr>   
             <tr>
                 <td class="ten"><p>BÀI VIẾT</p><p>&nbsp;</p></td>
                 <td><label>
                         <textarea class="mrk" name="baiviet" id="baiviet" cols="45" rows="5">
                            <?php echo $rows_chitiet['baiviet']?>
                         </textarea>
                     </label></td>
             </tr>    
             <tr>
                 <td class="ten"><p>SỐ LƯỢNG TỒN KHO</p><p>&nbsp;</p></td>
                 <td><input name="SoLuongTon" type="text" class="list" id="SoLuongTon" value="<?php  echo $rows_chitiet['SoLuongTonKho']?>"></td>
             </tr>    
             <tr>
                 <td class="ten"><p>GHI CHÚ</p><p>&nbsp;</p></td>
                 <td><input name="GhiChu" type="text" class="list" id="GhiChu" value="<?php echo $rows_chitiet['GhiChu']?>"></td>
              </tr>   
              <tr>
                  <td class="ten"><p>NEW</p><p>&nbsp;</p></td>
                  <td><p><input type="radio" name="New" value="0" id="New_0" <?php if($rows_chitiet['New']==0) echo"checked=checked";?>/>Mới
                          <input type ="radio" name="New" value=" 1" id="New_1" <?php if($rows_chitiet['New']==1) echo"checked=checked";?>/>Cũ</p>
                      
                  </td>
              </tr>    
              <tr>
                  <td colspan="2" align="center" class="ten"><label>
                          <input name="NgayCapNhat" type="hidden" id="NgayCapNhat" value="{Ngay}"/>
                          <input type="Submit" name="btnUpdate" id="btnUpdate" value="Update" onclick="return confirm('Bạn có muốn update dữ liệu này không ?')"/>
                       </label>
                      </td>

              </tr>   
        </table>
    </form>
